﻿

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>进度查询</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>

    <style>
        /* 这段样式只是用于演示 */
        #LAY-component-timeline .layui-card-body {
            padding: 15px;
        }
    </style>
    <div class="layui-form layui-card-header layuiadmin-card-header-auto">

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">订单号</label>
                <div class="layui-input-block">
                    <input type="text" name="lddocno" id="lddocno" placeholder="请输入订单号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                </button>
            </div>
        </div>

    </div>
    <div class="layui-fluid" id="LAY-component-timeline">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">进度结果</div>
                    <div class="layui-card-body">
                        <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-brief">
                            <ul class="layui-tab-title" id="tab_list">
                            </ul>
                            <div class="layui-tab-content" id="div_content">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
         
        </div>
    </div>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/js/jquery.min2.1.4.js"></script>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(decodeURI(r[2])); return null; //返回参数值
        }
        var djbh = getUrlParam('djbh');
        $("#lddocno").val(djbh);
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
            }).use(['index'], function () {
                var $ = layui.$
                    , form = layui.form
                    , element = layui.element
                    , router = layui.router();
                element.render();
                //element.on('tab(component-tabs-brief)', function (obj) {
                //    layer.msg(obj.index + '：' + this.innerHTML);
                //});
                //监听搜索
                form.on('submit(LAY-user-front-search)', function (data) {
                    var field = data.field;
                    //执行重载
                    var ddbh = $("#lddocno").val();
                    if (ddbh == "") {
                        //$("#ProgressMain").html("");
                        //$("#ProgressMain").html("无信息");
                    } else {
                        $.ajax({
                            url: 'ashx/list.ashx?type=getjd&OrderNo=' + ddbh,
                            type: "get",
                            contentType: "application/json",
                            dataType: "json",
                            data: {},
                            success: function (res) {
                                if (res.Status == "200") {
                                    if (res.IsSuccess == true) {
                                        $("#tab_list").html("");
                                        $("#div_content").html("");
                                        var tab = '';
                                        var strdetail = '';
                                        for (var i = 0; i < res.Data.length; i++) {
                                            if (i == 0) {
                                                tab += ' <li class="layui-this">' + res.Data[i].SapNo + '</li>';
                                                strdetail += '<div class="layui-tab-item layui-show">';
                                                var strmain = '';
                                                strmain += '订单号:' + res.Data[i].OrderNo + '；夏梦SAP号:' + res.Data[i].SapNo + '；成衣物料号:' + res.Data[i].ProdCode;
                                                strmain += '；订单数量:' + res.Data[i].Qty + '；订单状态:' + res.Data[i].OrderStatus;
                                                strdetail += ' <blockquote class="layui-elem-quote" id="ProgressMain">' + strmain + '</blockquote>';
                                                for (var j = 0; j < res.Data[i].ProgressDetails.length; j++) {
                                                    strdetail += ' <ul class="layui-timeline">';
                                                    strdetail += '<li class="layui-timeline-item">';
                                                    strdetail += '<i class="layui-icon layui-timeline-axis"></i>';
                                                    strdetail += '<div class="layui-timeline-content layui-text">';
                                                    strdetail += '<h3 class="layui-timeline-title">完工时间：' + res.Data[i].ProgressDetails[j].ProgressTime + '</h3>';
                                                    strdetail += '<ul>';
                                                    strdetail += '<li> 生产进度编号：' + res.Data[i].ProgressDetails[j].ProgressNo + '</li >';
                                                    strdetail += '<li>款式编码：' + res.Data[i].ProgressDetails[j].ModelCode + '</li>';
                                                    strdetail += '<li>订单品类：' + res.Data[i].ProgressDetails[j].Category + '</li>';
                                                    strdetail += '<li>生产进度：' + res.Data[i].ProgressDetails[j].ProgressStatus + '</li>';
                                                    strdetail += '<li>备注：' + res.Data[i].ProgressDetails[j].Remark + '</li>';
                                                    strdetail += '</ul>';
                                                    strdetail += '</div>';
                                                    strdetail += '</li>';
                                                    strdetail += '</ul>';
                                                }
                                                strdetail += '</div>';
                                            } else {
                                                tab += ' <li>' + res.Data[i].SapNo + '</li>';
                                                strdetail += '<div class="layui-tab-item">';
                                                var strmain = '';
                                                strmain += '订单号:' + res.Data[i].OrderNo + '；夏梦SAP号:' + res.Data[i].SapNo + '；成衣物料号:' + res.Data[i].ProdCode;
                                                strmain += '；订单数量:' + res.Data[i].Qty + '；订单状态:' + res.Data[i].OrderStatus;
                                                strdetail += ' <blockquote class="layui-elem-quote" id="ProgressMain">' + strmain + '</blockquote>';
                                                for (var j = 0; j < res.Data[i].ProgressDetails.length; j++) {
                                                    strdetail += ' <ul class="layui-timeline">';
                                                    strdetail += '<li class="layui-timeline-item">';
                                                    strdetail += '<i class="layui-icon layui-timeline-axis"></i>';
                                                    strdetail += '<div class="layui-timeline-content layui-text">';
                                                    strdetail += '<h3 class="layui-timeline-title">完工时间：' + res.Data[i].ProgressDetails[j].ProgressTime + '</h3>';
                                                    strdetail += '<ul>';
                                                    strdetail += '<li> 生产进度编号：' + res.Data[i].ProgressDetails[j].ProgressNo + '</li >';
                                                    strdetail += '<li>款式编码：' + res.Data[i].ProgressDetails[j].ModelCode + '</li>';
                                                    strdetail += '<li>订单品类：' + res.Data[i].ProgressDetails[j].Category + '</li>';
                                                    strdetail += '<li>生产进度：' + res.Data[i].ProgressDetails[j].ProgressStatus + '</li>';
                                                    strdetail += '<li>备注：' + res.Data[i].ProgressDetails[j].Remark + '</li>';
                                                    strdetail += '</ul>';
                                                    strdetail += '</div>';
                                                    strdetail += '</li>';
                                                    strdetail += '</ul>';
                                                }
                                                strdetail += '</div>';
                                            }
                                        }
                                        $("#tab_list").html(tab);
                                        $("#div_content").html(strdetail);
                                    }
                                    else {
                                        layer.msg("查询失败");
                                    }
                                }
                                else if (res.Status == "500") {
                                    layer.msg("系统异常");
                                }
                                else if (res.Status == "403") {
                                    layer.msg("签名验证失败");
                                }
                                else {
                                    layer.msg(res.Message);
                                }
                            }
                        })
                    }
                });

            });
    </script>
</body>
</html>